#define search()
<div class="layui-row">
  <div class="layui-col-md12">
    <fieldset class="layui-elem-field layui-field-title">
      <legend>搜索文章</legend>
    </fieldset>
    <form class="layui-row layui-form" action="">
      <div class="layui-col-md9">
        <input type="text" name="keyword" lay-verify="keyword" autocomplete="off" placeholder="请输入关键字" class="layui-input">
      </div>
      <div class="layui-col-md3">
        <button class="layui-btn" style="float: right;" lay-submit lay-filter="search">搜索</button>
      </div>
    </form>
  </div>
</div>
<script>
layui.use('form', function(){
  var form = layui.form;
  // 自定义验证
  form.verify({
    keyword: function(value) {
      console.log('value: ' + value)
      if (value == '') {
        return '请输入关键字';
      } else if(value.length < 2){
        return '至少两个字';
      }
    }
  });
});
</script>
#end